package org.jactao.v_1_0_test;

import org.jactao.common.LServiceConfig;
import org.jactao.common.LServerConfig;
import org.jactao.registry.LRedisRegistry;
import org.jactao.registry.LRegistry;
import org.jactao.boot.LBootstrap;
import org.jactao.v_1_0_test.service.LoginService;
import org.jactao.v_1_0_test.service.LoginServiceImpl;
import org.jactao.v_1_0_test.service.UserService;
import org.jactao.v_1_0_test.service.UserServiceImpl;

import java.io.IOException;

/**
 * Created by fanzetao on 2018/4/4.
 */
public class AppProvider {

    public static void main(String[] args) throws IOException {

        LRegistry registry = new LRedisRegistry(
                "127.0.0.1", 6379, "@gonghui@");
        registry.init();

        LServerConfig config = new LServerConfig();
        config.setRegistry(registry);

        LBootstrap bootstrap = new LBootstrap();
        bootstrap.setConfig(config);

        LServiceConfig serviceConfig1 = new LServiceConfig();
        serviceConfig1.setInterfaceClass(UserService.class);
        serviceConfig1.setImpl(new UserServiceImpl());

        LServiceConfig serviceConfig2 = new LServiceConfig();
        serviceConfig2.setInterfaceClass(LoginService.class);
        serviceConfig2.setImpl(new LoginServiceImpl());

        bootstrap.export(serviceConfig1);
        bootstrap.export(serviceConfig2);

        bootstrap.run();

        System.in.read();
    }
}
